import java.util.Vector;

public class Directory extends Entry {
    private final String name; // 目录名称
    private final Vector<Entry> directory = new Vector<>();  // entry的集合

    public Directory(String name) {           // 建構子
        this.name = name;
    }

    public String getName() {                 // 取得目錄名稱 
        return name;
    }

    public int getSize() { // 取得目录容量
        int size = 0;
        for (Entry entry : directory) {
            size += entry.getSize();
        }
        return size;
    }

    public Entry add(Entry entry) { // 新增entry
        directory.add(entry);
        return this;
    }

    protected void printList(String prefix) { // entry的总览
        System.out.println(prefix + "/" + this);
        for (Entry entry : directory) {
            entry.printList(prefix + "/" + name);
        }
    }
} 


